﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Input;

namespace LNUGame.View
{
    class GameInputHandler
    {
        private KeyboardState m_currentKeyboardState;
        private KeyboardState m_lastKeyboardState;

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        internal bool DidPlayerPressEsc()
        {
            bool b = false;
            m_currentKeyboardState = Keyboard.GetState();

            if (m_currentKeyboardState.IsKeyDown(Keys.Escape))
            {
                b = true;
            }

            return b;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        internal bool DidPlayerPressRight()
        {
            bool b = false;
            m_currentKeyboardState = Keyboard.GetState();

            if (m_currentKeyboardState.IsKeyDown(Keys.Right))
            {
                b = true;
            }

            return b;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        internal bool DidPlayerPressLeft()
        {
            bool b = false;
            m_currentKeyboardState = Keyboard.GetState();

            if (m_currentKeyboardState.IsKeyDown(Keys.Left))
            {
                b = true;
            }

            return b;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        internal bool DidPlayerPressJump()
        {
            bool b = false;
            m_currentKeyboardState = Keyboard.GetState();

            if (m_lastKeyboardState.IsKeyDown(Keys.Space))
            {
                b = true;
            }
            m_lastKeyboardState = m_currentKeyboardState;

            return b;
        }
    }
}
